Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

debug-threads-ns

Package Overview
Dependencies
Maintainers
1
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

debug-threads-ns

Debug namespace structure helper coupled with thread-context

  • 0.2.3
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

NPM Build Status npm version npm

debug-threads-ns

This module is located at https://github.com/Aggtaa/debug-threads-ns. Any other location is either a fork or a copy.

Overview

This module is a simple helper for debug namespaces, especially useful for typescript projects.

You can provide static namespace structure or embed thread-context dynamic namespace identifying current "thread".

Usage

Its this simple:

import { debug, setup, ExtendedDebugger, threadContext } from "debug-threads-ns";
import express from 'express';

setup('myAppName');

export interface Debugger extends ExtendedDebugger {
    db: ExtendedDebugger;
    web: ExtendedDebugger & {
        thread: ExtendedDebugger;
    };
}

debug.warn('Process started');
// renders line "myappaname Process started"

const app = new express.Express();
debug.web.info('Express app created');
// renders line "myappaname:web Express app created"
app.use((req, res, next) => {
    threadContext.init();
    debug.web.thread.debug(req.method + ' ' + req.originalPath);
    // renders line "myappaname:web:$h4JJd20L GET /"
});

Keywords

FAQs

Package last updated on 27 Sep 2023

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc